#include "/Engine/Generated/Material.ush" #include "/Engine/Public/Platform.ush" RWTexture2D RenderTarget; [numthreads(THREADS_X, THREADS_Y, THREADS_Z)] void ${this.answers.name}( uint3 DispatchThreadId : SV_DispatchThreadID, uint GroupIndex : SV_GroupIndex ) { float4 SvPosition = float4(DispatchThreadId.xy, 0, 0); FMaterialPixelParameters MaterialParameters = MakeInitializedMaterialPixelParameters(); // There are various inputs we can provide to the material graph via FMaterialPixelParameters // See: https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Shaders/Private/MaterialTemplate.ush#L262 MaterialParameters.VertexColor = half4(1, 1, 0, 1); FPixelMaterialInputs PixelMaterialInputs = (FPixelMaterialInputs)0; // This is the call to the material graph CalcMaterialParameters(MaterialParameters, PixelMaterialInputs, SvPosition, true); // PixelMaterialInputs is a struct that contains the outputs of the material graph // Use the provided helper methods ( GetMaterialXYZ(...) ) to access the outputs // See: https://github.com/chendi-YU/UnrealEngine/blob/master/Engine/Shaders/MaterialTemplate.usf#L1298 RenderTarget[DispatchThreadId.xy] = GetMaterialBaseColor(PixelMaterialInputs); }